﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Csharp虚方法
{
    class person
    {
        public string name;

        //打卡方法

        public virtual void ClockIn() 
        {
            Console.WriteLine("这个是父类");
        }

        //因为都是object的子类
        //重写to string
        public override string ToString()
        {
            return string.Format("我是{0}",name);
            //复习一个知识点
            //string.Format("我是{0}",name);----格式化输出字符串
        }
    }


    class Employee : person 
    {
        public override void ClockIn()
        {
            Console.WriteLine("{0}9点上班打卡",name);
        }
    }



    class Manager : person 
    {
        public override void ClockIn()
        {
            Console.WriteLine("{0}11点上班打卡", name);
        }
    }


    class Programmer : person
    {
        public override void ClockIn()
        {
            Console.WriteLine("{0}不打卡", name);
        }
    }
}
